package com.zhz.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @date ：Created in 2021/02/06
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 * @description:
 **/
@Component
public class RabbitMQListener {
    /**
     * 监听队列
     *
     * @param message
     */
    @RabbitListener(queues = "boot_queue")
    public void ListenerQueue(Message message) {
        System.out.println("boot_queue--监听到的数据: " + new String(message.getBody()));
        System.out.println("监听到的信息 属性 DeliveryTag: " + message.getMessageProperties().getDeliveryTag());
        System.out.println("监听到的信息 属性: " + message.getMessageProperties());
    }


    @RabbitListener(queues = "boot_queue1")
    public void ListenerQueue1(Message message) {
        System.out.println("boot_queue1--监听到的数据: " + new String(message.getBody()));
        System.out.println("监听到的信息 属性 DeliveryTag: " + message.getMessageProperties().getDeliveryTag());
        System.out.println("监听到的信息 属性: " + message.getMessageProperties());
    }


    @RabbitListener(queues = "boot_queue2")
    public void ListenerQueue2(Message message) {
        System.out.println("boot_queue2--监听到的数据: " + new String(message.getBody()));
        System.out.println("监听到的信息 属性 DeliveryTag: " + message.getMessageProperties().getDeliveryTag());
        System.out.println("监听到的信息 属性: " + message.getMessageProperties());
    }

}
